from typing import List

from pydantic import Field

from common.base_models import InfectionMonkeyBaseModel
from common.types import NetworkPort


class MSSQLOptions(InfectionMonkeyBaseModel):
    target_ports: List[NetworkPort] = Field(
        default=[1433],
        description="A list of TCP ports that the MSSQL exploiter will try to exploit.",
    )
    try_discovered_mssql_ports: bool = Field(
        default=False,
        description="Attempt to exploit MSSQL on ports discovered from network scanning"
        " used by an MSSQL service.",
    )
    try_unknown_service_ports: bool = Field(
        default=False,
        description="Attempt the exploiter on all discovered, open TCP ports where"
        " the listening service cannot be positively identified.",
    )
    server_timeout: float = Field(
        gt=0.0,
        default=15.0,
        description="The maximum time (in seconds) to wait for response from the MSSQL server.",
    )
    agent_binary_download_timeout: float = Field(
        gt=0.0,
        default=60.0,
        description="The maximum time (in seconds) to wait for a successfully exploited"
        " MSSQL server to download the agent binary.",
    )
